﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IHandleResources.cs" company="XamlNinja">
//   2011 Richard Griffin and Ollie Riches
// </copyright>
// <summary>
//   Interface defining the factory for create implementations of the interface IHandleResources.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WP7Contrib.Communications
{
    public interface IHandleResourcesFactory
    {
        /// <summary>
        /// Creates a resource handler
        /// </summary>
        /// <returns>Returns the created resource hansler.</returns>
        IHandleResources Create();

        /// <summary>
        /// The namespace used the resource handler - usually used with SOAP operations.
        /// </summary>
        /// <param name="prefix">
        /// The prefix.
        /// </param>
        /// <param name="namespace">
        /// The namespace to supplied for accessing the resource.
        /// </param>
        /// <returns>
        /// Returns the instance of the interface - fluent interface style.
        /// </returns>
        IHandleResourcesFactory WithNamespace(string prefix, string @namespace);

        /// <summary>
        /// The basic authentication used with the resource handler.
        /// </summary>
        /// <param name="username">
        /// The username.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// Returns the instance of the interface - fluent interface style.
        /// </returns>
        IHandleResourcesFactory WithBasicAuthentication(string username, string password);

        IHandleResourcesFactory WithGzip();

        /// <summary>
        ///  Allows the setting of how the json serializer will handle common serialization problems such
        /// as missing methods, reference loops etc. when the resource handler is created.
        /// </summary>
        /// <param name="definitions">The defintions</param>
        /// <returns>Returns the instance of the interface - fluent interface style.</returns>
        IHandleResourcesFactory WithHandlerDefinitions(JsonHandlerDefinitions definitions);

        /// <summary>
        /// Allows the setting of headers on the resource handler when created, many headers can be defined, but only one per 'Name'
        /// </summary>
        /// <param name="header">The header.</param>
        /// <returns>Returns the instance of the interface - fluent interface style.</returns>
        IHandleResourcesFactory WithHeader(IHeader header);

    }
}